﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Diagnostics;
using System.Windows.Forms;

namespace GUI_bci1
{
    public partial class UIform : Form
    {
        string test="false",res="800x600",protocol="E:\\Documents and Settings\\Fegx\\Documenti\\Visual Studio 2010\\Projects\\bci1\\bci1\\bci1\\bin\\x86\\Debug\\bci1.exe";
       // System.Diagnostics.Process p = new System.Diagnostics.Process();
        public UIform()
        {
            InitializeComponent();
        }

        private void button1_Click(object sender, EventArgs e)
        {
            using (Process p = new Process())
            {
                this.Refresh();
                this.Update();
                ProcessStartInfo info = new ProcessStartInfo(@protocol);
                string arg = test+" "+res;
                info.Arguments=arg;
                info.RedirectStandardInput = true;
                info.RedirectStandardOutput = true;
                info.UseShellExecute = false;
                p.StartInfo = info;
                p.Start();

                p.WaitForExit();
            }
        }

        public void FullScreen_CheckedChanged(object sender, EventArgs e)
        {
            if (test == "false") { test = "true"; } else { test = "false"; }
        }

        private void textBox1_TextChanged(object sender, EventArgs e)
        {
            var asd = textBox1.Text;
        }

        private void Resoluton_SelectedIndexChanged(object sender, EventArgs e)
        {
            res = Resoluton.Text;
        }

        private void Protocol_SelectedIndexChanged(object sender, EventArgs e)
        {
            protocol = Protocol.Text;
        } 
    }
}
